<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>提示跳转</title>
    <!-- bootstrap -->
    <link rel="stylesheet" href="{{URL::asset('assets/css/bootstrap.min.css')}}" />
    <style>
        body {
            background-color: #fff;
        }

        .error-page {
            height: 100%;
            position: fixed;
            width: 100%;
        }

        .error-body {
            padding-top: 20%;
            margin-top: 50%;
            transform: translateY(-50%);
        }

        .error-body h1 {
            font-size: 210px;
            font-weight: 700;
            text-shadow: 4px 4px 0 #f5f6fa, 6px 6px 0 #33cabb;
            line-height: 210px;
            color: #33cabb;
        }

        .error-body h4 {
            margin: 30px 0px;
        }

        .notice {
            width: 100px;
            height: 100px;
            margin: 0 auto;
        }

        .notice img {
            width: 100%;
        }
    </style>
</head>

<body>
    <section class="error-page">
        <div class="error-box">
            <div class="error-body text-center">
                <?php if ($code == 1) { ?>
                    <div class="notice">
                        <img src="{{URL::asset('assets/images/success.svg')}}" />
                    </div>
                <?php } else { ?>
                    <div class="notice">
                        <img src="{{URL::asset('assets/images/error.svg')}}" />
                    </div>
                <?php } ?>
                <h4><?php echo strip_tags($msg); ?></h4>
                等待<b id="time"><?php echo $wait;?></b>秒后自动跳转，或者
                <a id="url" href="<?php echo $url; ?>">点击链接跳转</a>
            </div>
        </div>
    </section>
</body>

</html>
<script type="text/javascript" src="{{URL::asset('assets/js/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{URL::asset('assets/js/bootstrap.min.js')}}"></script>
<script>
    // 获取url
    var url = `{{$url}}`

    function autoplay()
    {
        // 获取跳转的时间并且转成整数
        var time = parseInt($('#time').text())

        if(time <= 0)
        {
            // 清除循环定时器
            clearInterval(T)

            // 跳转指定url地址
            location.href = url

            return false
        }

        $('#time').text(time - 1)
    }

    // 设置循环定时器
    var T = setInterval(autoplay, 1000)
    
</script>